<?php

/**
 * Menashop
 *
 * LICENSE
 *
 * This source file is subject to the license that is bundled
 * with this project in the file LICENSE.txt
 *
 * @category   Zend
 * @package    Admin_Model
 * @subpackage FormDistributorPrices
 * @copyright  Copyright (c) 2011 Menashop UA Inc. (http://www.menashop.com.ua)
 * @license    LICENSE.txt
 * @version    1.0.0
 * @since      File available since Release 1.0.0
 */

/**
 * The form for distributor prices
 * 
 * @category   Zend
 * @package    Admin_Model
 * @subpackage FormDistributorPrices
 * @copyright  Copyright (c) 2011 Menashop UA Inc. (http://www.menashop.com.ua)
 * @license    LICENSE.txt
 */
class Admin_Model_FormDistributorPrices extends Zend_Form
{

    public function init()
    {
        $this->setMethod('post');

        $page = new Zend_Form_Element_Text('page');
        $page->removeDecorator('label');
        $page->removeDecorator('htmlTag');
        $page->removeDecorator('Errors');
        $this->addElement($page);

        $rows = new Zend_Form_Element_Select('rows');
        $rowsOnPage = array('20', '50', '100');
        foreach ($rowsOnPage as $value) {
            $rows->addMultiOption($value, $value);
        }
        $rows->removeDecorator('label');
        $rows->removeDecorator('htmlTag');
        $rows->removeDecorator('Errors');
        $this->addElement($rows);

        $recordsCount = new Zend_Form_Element_Text('records_count');
        $this->addElement($recordsCount);

        $pagesCount = new Zend_Form_Element_Text('pages_count');
        $this->addElement($pagesCount);

        $sort = new Zend_Form_Element_Hidden('sort');
        $sort->removeDecorator('label');
        $sort->removeDecorator('htmlTag');
        $sort->removeDecorator('Errors');
        $this->addElement($sort);

        $direction = new Zend_Form_Element_Hidden('direction');
        $direction->removeDecorator('label');
        $direction->removeDecorator('htmlTag');
        $direction->removeDecorator('Errors');
        $this->addElement($direction);

        $name = new Zend_Form_Element_Text('name');
        $name->removeDecorator('label');
        $name->removeDecorator('htmlTag');
        $name->removeDecorator('Errors');
        $name->setAttrib('class', 'text-field');
        $this->addElement($name);

        $productId = new Zend_Form_Element_Text('product_id');
        $productId->removeDecorator('label');
        $productId->removeDecorator('htmlTag');
        $productId->removeDecorator('Errors');
        $productId->setAttrib('class', 'number-field');
        $this->addElement($productId);

        $productMpn = new Zend_Form_Element_Text('product_mpn');
        $productMpn->removeDecorator('label');
        $productMpn->removeDecorator('htmlTag');
        $productMpn->removeDecorator('Errors');
        $productMpn->setAttrib('class', 'text-field');
        $this->addElement($productMpn);

        $manufacturerName = new Zend_Form_Element_Text('manufacturer_name');
        $manufacturerName->removeDecorator('label');
        $manufacturerName->removeDecorator('htmlTag');
        $manufacturerName->removeDecorator('Errors');
        $manufacturerName->setAttrib('class', 'text-field');
        $this->addElement($manufacturerName);

        $distributorName = new Zend_Form_Element_Text('distributor_name');
        $distributorName->removeDecorator('label');
        $distributorName->removeDecorator('htmlTag');
        $distributorName->removeDecorator('Errors');
        $distributorName->setAttrib('class', 'text-field');
        $this->addElement($distributorName);

        $updatedFrom = new Zend_Form_Element_Text('updated_from');
        $updatedFrom->removeDecorator('label');
        $updatedFrom->removeDecorator('htmlTag');
        $updatedFrom->removeDecorator('Errors');
        $updatedFrom->setAttrib('class', 'date-field');
        $this->addElement($updatedFrom);

        $updatedTo = new Zend_Form_Element_Text('updated_to');
        $updatedTo->removeDecorator('label');
        $updatedTo->removeDecorator('htmlTag');
        $updatedTo->removeDecorator('Errors');
        $updatedTo->setAttrib('class', 'date-field');
        $this->addElement($updatedTo);

        $priceFrom = new Zend_Form_Element_Text('price_from');
        $priceFrom->removeDecorator('label');
        $priceFrom->removeDecorator('htmlTag');
        $priceFrom->removeDecorator('Errors');
        $priceFrom->setAttrib('class', 'number-field');
        $this->addElement($priceFrom);

        $priceTo = new Zend_Form_Element_Text('price_to');
        $priceTo->removeDecorator('label');
        $priceTo->removeDecorator('htmlTag');
        $priceTo->removeDecorator('Errors');
        $priceTo->setAttrib('class', 'number-field');
        $this->addElement($priceTo);

        $publicPriceFrom = new Zend_Form_Element_Text('public_price_from');
        $publicPriceFrom->removeDecorator('label');
        $publicPriceFrom->removeDecorator('htmlTag');
        $publicPriceFrom->removeDecorator('Errors');
        $publicPriceFrom->setAttrib('class', 'number-field');
        $this->addElement($publicPriceFrom);

        $publicPriceTo = new Zend_Form_Element_Text('public_price_to');
        $publicPriceTo->removeDecorator('label');
        $publicPriceTo->removeDecorator('htmlTag');
        $publicPriceTo->removeDecorator('Errors');
        $publicPriceTo->setAttrib('class', 'number-field');
        $this->addElement($publicPriceTo);

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Search');
        $submit->setAttrib('id', 'search-button');
        $submit->removeDecorator('DtDdWrapper');
        $this->addElement($submit);

        $this->setDecorators(array(array('ViewScript', array('viewScript' => '_form_distributor_prices.phtml'))));
    }

}

